--罗技鼠标宏LUA语言,参考文档:G-series Lua API

Hege_Macro_LoopInterval = 10 --脚本循环间隔（毫秒）

EnablePrimaryMouseButtonEvents(true)  --开启响应鼠标事件

function OnEvent(event, arg, family)
	--if (event == "G_RELEASED" and arg == 4) then --4为罗技键盘G4键
	if (event == "MOUSE_BUTTON_RELEASED" and arg == 6 and IsKeyLockOn("scrolllock")) then --这里的3为罗技鼠标中键，4-9数字为鼠标侧键
		PaomaTianquan()
	end

	if (event == "MOUSE_BUTTON_RELEASED" and arg == 6 and IsKeyLockOn("capslock")) then --这里的3为罗技鼠标中键，4-9数字为鼠标侧键
		LasimaDajun()
	end

	if (event == "MOUSE_BUTTON_RELEASED" and arg == 4 and IsKeyLockOn("scrolllock")) then --这里的3为罗技鼠标中键，4-9数字为鼠标侧键
		--xfz()
	end
end

-------------------------------------------------------------------------------------------------------------------------------

--F2：站立攻击
--F7：强制移动

--F3键（暗黑3导航功能键）：快速拾取装备、分解背包装备、血岩购买装备
---------------------------通用--------------------------
--左键技能
function zoujian()
	while (IsKeyLockOn("scrolllock")) do
		if (IsModifierPressed("shift")) then
			PressKey("f2")
			Sleep(100)
			PressAndReleaseMouseButton(1)--点击左键
			Sleep(100)
		end
		ReleaseKey("f2")
	end
	ReleaseKey("f2")
end

--------------------------圣教军--------------------------

--跑马天拳
function PaomaTianquan()
	if (IsKeyLockOn("scrolllock")) then
		--左键技能
		PressKey("f2")
		Sleep(25)
		PressAndReleaseMouseButton(1)--点击左键
		Sleep(25)
		ReleaseKey("f2")
		Sleep(50)

		PressAndReleaseKey("4")
		Sleep(50)
		PressAndReleaseKey("3")
		Sleep(50)
		PressAndReleaseKey("2")
		Sleep(50)
		PressAndReleaseKey("1")
		Sleep(50)

		Times_Key_F7 = 0
		Times_Key_1 = 0
	end

	while (IsKeyLockOn("scrolllock")) do
		Sleep(Hege_Macro_LoopInterval) --循环间隔

		Times_Key_F7 = Times_Key_F7 + 1
		Times_Key_1 = Times_Key_1 + 1

		--每N秒按下并释放F7键（强制移动）
		if ((Times_Key_F7*Hege_Macro_LoopInterval) >= 80) then
			if (IsModifierPressed("shift")) or (IsMouseButtonPressed(3)) then --按住shift键或者鼠标右键（3）中断强制移动

			else
				PressAndReleaseKey("f7")--点击F7键
			end
			Times_Key_F7 = 0
		end

		--每N秒按下并释放4321键，办公室3100毫秒后重置，家里4300毫秒后重置
		if ((Times_Key_1*Hege_Macro_LoopInterval) >= 4300) then
			PressKey("f2")
			Sleep(25)
			PressAndReleaseMouseButton(1)--点击左键
			Sleep(25)
			ReleaseKey("f2")
			Sleep(50)

			PressAndReleaseKey("4")
			Sleep(50)
			PressAndReleaseKey("3")
			Sleep(50)
			PressAndReleaseKey("2")
			Sleep(50)
			PressAndReleaseKey("1")
			Sleep(50)
			Times_Key_1 = 0
		end
	end
end

-------------------------死灵法师-------------------------

--拉斯玛大军
function LasimaDajun()
	if (IsKeyLockOn("capslock")) then
		Times_Key_F7 = 0
	end

	while (IsKeyLockOn("capslock")) do
		Sleep(Hege_Macro_LoopInterval) --循环间隔

		Times_Key_F7 = Times_Key_F7 + 1

		if ((Times_Key_F7*Hege_Macro_LoopInterval) >= 80) then
			if (IsMouseButtonPressed(3)) then --按住shift键或者鼠标右键（3）中断强制移动
				Sleep(100)
				PressAndReleaseKey("2")

				Sleep(20)
				PressKey("f2")
				Sleep(20)
				PressAndReleaseMouseButton(1)--点击左键
				Sleep(20)
				ReleaseKey("f2")

				Sleep(20)
				PressAndReleaseKey("3")
				Sleep(20)
				PressAndReleaseKey("3")
				Sleep(20)
				PressAndReleaseKey("3")
			else
				--PressAndReleaseKey("f7")--点击F7键
			end
			Times_Key_F7 = 0
		end
	end
	ReleaseKey("f2")
end